use serde::{Deserialize, Serialize};

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Word {
    pub word: String,
    pub meaning: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DictationConfig {
    pub volume: f32,
    pub rate: f32,
    pub voice: String,
    pub random_mode: bool,
    pub show_meaning: bool,
    pub auto_play: bool,
    pub interval: i32,
    pub repeat_word: bool,
    pub repeat_count: i32,
    pub repeat_delay: i32,
}

impl Default for DictationConfig {
    fn default() -> Self {
        Self {
            volume: 1.0,
            rate: 1.0,
            voice: "Microsoft David - English (United States)".to_string(),
            random_mode: false,
            show_meaning: true,
            auto_play: true,
            interval: 3,
            repeat_word: true,
            repeat_count: 2,
            repeat_delay: 2,
        }
    }
}

#[derive(Debug, Clone)]
pub struct DictationState {
    pub words: Vec<Word>,
    pub current_index: usize,
    pub is_playing: bool,
    pub config: DictationConfig,
}

impl Default for DictationState {
    fn default() -> Self {
        Self {
            words: vec![],
            current_index: 0,
            is_playing: false,
            config: DictationConfig::default(),
        }
    }
}